package com.sfac.day03.modules.account.dao;

import com.sfac.day03.modules.account.entity.UserRole;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface UserRoleDao {
    @Insert("insert into account_user_role(user_id,role_id) values(#{userId},#{roleId})")
    @Options(useGeneratedKeys = true,keyColumn = "id",keyProperty = "id")
    public abstract int insertUserRole(UserRole userRole);

    @Delete("delete from account_user_role where user_id=#{userId}")
    public abstract int deleteUserRoleByUserId(Integer userId);
    @Delete("delete from account_user_role where role_id=#{roleId}")
    public abstract int deleteUserRoleByRoleId(Integer roleId);
}
